Skip to content

Refactor/#66 chatbot api - #67

Closed
docodocod wants to merge 2 commits into
mainfrom
refactor/#66-chatbot-api
Closed

Refactor/#66 chatbot api#67
docodocod wants to merge 2 commits into
mainfrom
refactor/#66-chatbot-api

Conversation

@docodocod

Copy link
Copy Markdown
Contributor

📢 기능 설명

챗봇 기능 확장 및 쿠폰 조회 버그 수정

필요시 실행결과 스크린샷 첨부

연결된 issue

연결된 issue를 자동을 닫기 위해 아래 {이슈넘버}를 입력해주세요.

close #{이슈넘버}

✅ 체크리스트

  • PR 제목 규칙 잘 지켰는가?
  • 추가/수정사항을 설명하였는가?
  • 이슈넘버를 적었는가?

johe00123 and others added 2 commits May 15, 2026 22:35
- 취소/노쇼 예약 내역 조회 AI Tool 추가
- 주변 인기 맛집 추천 AI Tool 추가 (반경 3km, 인기순 정렬)
- 예약 가능 시간대 조회 AI Tool 추가
- 챗봇 요청에 위치 좌표(latitude/longitude) 필드 추가
- 쿠폰 목록 API Cache-Control: no-store 추가
- 챗봇 대화 내역 조회 시 세션 없으면 빈 목록 반환으로 수정
- SecurityConfig ASYNC DispatcherType 설정 제거

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@docodocod docodocod closed this May 18, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly enhances the chatbot's capabilities by integrating location-based store searches, reservation management (viewing and canceling), and a new payment flow. Key technical changes include the introduction of conversation summarization for long histories, the use of ThreadLocal for pending payment info, and the addition of several AI-driven tools. Review feedback highlights critical performance improvements, such as resolving an N+1 query issue in the reservation service, addressing latency caused by synchronous AI summarization, and optimizing store lookups by moving filtering from memory to the database.

Comment on lines +305 to +309
Map<Long, String> orderIdByReservationId = new HashMap<>();
for (Long pendingId : pendingIds) {
paymentRepository.findByReservation_Id(pendingId)
.ifPresent(p -> orderIdByReservationId.put(pendingId, p.getOrderId()));
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

루프 내에서 paymentRepository.findByReservation_Id를 반복 호출하여 N+1 쿼리 문제가 발생하고 있습니다. pendingIds 목록을 한 번에 전달하여 IN 절을 사용하는 쿼리로 모든 관련 Payment 정보를 조회한 뒤, 이를 Map으로 변환하여 사용하는 방식이 성능 면에서 훨씬 유리합니다.

Comment on lines +152 to 155
String summary = chatClient.prompt()
.user("다음 대화를 핵심 정보(예약 정보, 사용자 선호 등)만 3문장 이내로 요약해줘:\n" + historyText)
.call()
.content();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

사용자의 메시지를 처리하는 과정에서 대화 요약을 위해 별도의 AI 호출을 동기적으로 수행하고 있습니다. 이는 챗봇의 전체 응답 지연 시간(Latency)을 크게 증가시키는 요인이 됩니다. 요약 작업을 비동기적으로 처리하거나, 대화 이력이 특정 임계치 이상 쌓였을 때만 요약을 수행하는 등의 최적화 전략을 고려해 보시기 바랍니다.

Comment on lines +88 to +91
Store store = storeRepository.findAllByIsDeletedFalse().stream()
.filter(s -> s.getStoreName().equalsIgnoreCase(storeName))
.findFirst()
.orElse(null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

모든 활성 매장 목록을 메모리로 가져온 후 스트림 필터를 사용하여 매장을 찾는 방식은 매장 수가 늘어날수록 성능이 저하됩니다. StoreRepository에 매장 이름으로 직접 조회하는 메서드(예: findByStoreNameAndIsDeletedFalse)를 추가하여 데이터베이스 인덱스를 활용하도록 개선하는 것이 효율적입니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants